//
//  MLXPPageTableView.h
//  MLX
//
//  Created by SY on 2018/10/8.
//  Copyright © 2018年 SY. All rights reserved.
//

#import "MLXGroup.h"

@interface MLXGroup ()

@property (nonatomic, strong) dispatch_group_t executeGroup;

@end


@implementation MLXGroup

- (instancetype)init
{
    if (self = [super init]) {
        self.executeGroup = dispatch_group_create();
    }
    return self;
}

- (void)wait
{
    dispatch_group_wait(self.executeGroup, DISPATCH_TIME_FOREVER);
}

- (void)enter
{
    dispatch_group_enter(self.executeGroup);
}

- (void)leave
{
    dispatch_group_leave(self.executeGroup);
}

- (BOOL)wait: (NSTimeInterval)delay
{
    return dispatch_group_wait(self.executeGroup, delay * NSEC_PER_SEC) == 0;
}

@end
